<!--
  * new page
  * @module: 自定义模板
  * @author: YK
  * @since: 2024-06-27
  * CustomSchemaTemplate.vue
 -->
<template>
  <ul class="custom-schema-template" >
    <li v-for="(item, key, index) in field" :key="index">
      <component :is="item.type" :field="item" :key="index"></component>
    </li>
  </ul>
</template>

<script setup lang="ts">
import { useWidgetsStore } from "@/store/widgets";
import { storeToRefs } from "pinia";
const store = useWidgetsStore();
const { currentComponent } = storeToRefs(store);
const field = computed(() => {
  if (currentComponent.value) {
    return currentComponent.value.field;
  }
  return {};
});
</script>

<style scoped lang="scss">
ul {
  list-style: none;
  padding: 10px 30px;
  margin: 0;
}
</style>
